home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / UNIX / DISCRETE.ZIP / DISCRETE.DOC
Text File  |  1996-05-19  |  35KB  |  772 lines

  1. The THC Hack/Phreak Archives: DISCRETE.DOC (2088 lines)
  2. Note: I did not write any of these textfiles.  They are being posted from
  3. the archive as a public service only - any copyrights belong to the
  4. authors.  See the footer for important information.
  5. ==========================================================================
  6.  
  7.                    ///////////////////////////////////////////
  8.                   // Baldrick's guide to discrete UNIX use //
  9.                  //     Complete with Internet babble     //
  10.                 ///////////////////////////////////////////
  11.  
  12.                  First edition: Never before released in
  13.                                 any bloody form.
  14.  
  15. ..       Volume 1:  The story so far....
  16.  
  17. ==============================================================================
  18.  DISCLAIMER:  I didn't write this file.  Someone else did and framed me using
  19.               my pseudo so I'm obivously not liable for any of it.  He went
  20.               that way.
  21.  
  22.  TEASER:  If you really liked this file then just wait a bit and if I figure
  23.           out any new and funky interesting tips I'll put them out too in a
  24.           text phile series that would make Maury Pauvich turn green.
  25. ==============================================================================
  26.  
  27.                                  //////////////
  28.                                 ///Contents///
  29.                                //////////////
  30.  
  31. .(if you wanna find it quick, search for the contents number x.x)
  32.  
  33. 1.0.Introduction (aka mindless self-indulged ego statements and pseudo-
  34.                       visionary babble about the realisation of Cyberspace)
  35.  
  36. 2.0 UNIX from DOS in thirty minutes or your money back
  37.  
  38.     2.1     Logging in and logging out
  39.     2.2     Basic file manipulation
  40.     2.3     The manic man command
  41.     2.4     Reaching Nirvanna through ed(1) (text manipulation)
  42.     2.5     Intra-system communication - who, finger, write, talk, etc.
  43.     2.6     Multitasking without L.S.D.
  44.     2.7     Security - file permissions and chmod
  45.  
  46. 3.0.Playtime on your local system
  47.  
  48.     3.1     aliasing commands
  49.     3.2     Shell scripts (incl. ~/.*)
  50.     3.3     Changing your default shell and the tcsh shell.
  51.     3.4     Causing mindless havoc through write and other childish tricks
  52.     3.5     The Importance of Being Earnest (hiding what you are doing)
  53.     3.6     cat /etc/passwd > ~/lab7.h
  54.     3.7     Security - A couple of cunning plans
  55.  
  56. 4.0.Reach out and touch someone (playing with the Internet)
  57.     4.1     finger, talk, and mail to remote clients
  58.     4.2     USENet newsgroups
  59.     4.3     telnet and rlogin
  60.     4.4     FTP and FSP
  61.     4.5     Gopher
  62.     4.6     MUD, MUSH, MUCK, MUSE, IRC
  63.  
  64. 5.0.Piracy and Internet
  65.     5.1     The Internet Pirate:  Scourge of the Network
  66.     5.2     Getting Contacts
  67.     5.3     Information Trading
  68.     5.4     Paranoia (how to not get caught)
  69.     5.5     Aside: Faking Mail
  70.     5.6     Aside: Naughty Pictures
  71.  
  72. 6.0.Onwards to Victory
  73.  
  74.  
  75.            .        //////////////////////
  76. .     .       // 1.0 Introduction //
  77.                       //////////////////////
  78.  
  79. So I wanna be a guru...   A couple years ago, the foolish computer science
  80. faculty at my post-secondary institution were nice enough to give me my very
  81. own spanking new UNIX account.  After spending the first afternoon buggering
  82. around typing the only command I thought I knew ("sh us", actually a VMS
  83. command that had somehow sprung into my head), I gave up the cause of getting
  84. any information for lost.
  85.  
  86. My lethargy soon lifted, however, and I set out on a quest to get some
  87. information on UNIX. The computing services people graciously provided me
  88. with two duplexed photocopy sheets of information, and I supplemented that
  89. with Brian Kernaghan's "A Beginner's Guide to UNIX" and then I was on my way.
  90. Now it seems that lots of people I know are just getting into the UNIX
  91. / Internet thing and want to know how to USE it.  Not how to read their mail
  92. and play MUD, but all sorts of things that go on slightly under the table...
  93.  
  94. "I don't know much, but here's something to get you started" I invariably
  95. reply to these people and promptly wear myself out typing page after page of
  96. "Oh, P.S. - you might also want to ..." statements.  And so, I've set out to
  97. create what you have before you - Baldrick's guide to discrete UNIX use.
  98. This is an attempt at answering all the questions I had when I was learning
  99. and couldn't find the answers.  I was very lucky to know some people who
  100. dropped me hints and put up with my whining - the best way to learn UNIX is
  101. apprenticeship it seems (the guild system alive and well?).
  102.  
  103. To close off this lofty and drab introduction, I'd like to offer ceremonial
  104. gold stars for cooperation and UNIX knowhow to Gollum, without whom I would
  105. probably be hanging out in #esperanto. Thanks also to Puzzling Evidence, who
  106. although by his own admission "UNIX dumb" managed to find out a hell of a lot
  107. and write a damn good article about it before I was even a sparkle in the
  108. great big Computing Services martini.  Stingray also gets some honorable
  109. mention for his general smarts in UNIX nastiness.
  110.  
  111.  
  112.          /////////////////////////////////////////////////////////
  113.         // 2.0 UNIX from DOS in ten minutes or your money back //
  114.        /////////////////////////////////////////////////////////
  115.  
  116. 2.1 Logging in and Logging out
  117. ------------------------------
  118.  
  119. You begin here.
  120.  
  121. There are two obvious ways of getting onto a system to log in - one is by
  122. using an ever-so-stylish terminal, and the other is by actually phoning in
  123. from home using communications software.  There are usually machine-specific
  124. ways of doing each (wake-up commands for the terminals, and wierd tripped out
  125. modem settings like 9600 7O1) which you will have to find out from whoever
  126. gave (stole?) you an account.
  127.  
  128. When you do finally get connected to the UNIX system, you will see a header
  129. resembling this:
  130.  
  131. SunOS UNIX (systemid)
  132.  
  133. login:
  134.  
  135. The login: prompt is the infamous hallmark of a UNIX system.  You will have
  136. a user id which can be up to 8 characters and which is typed entirely in
  137. lower case.  This is often your first initial followed by your last name (or
  138. the first seven letters of it).  Once you have entered a login id, regarldess
  139. of whether it is right or wrong, you will see the prompt
  140.  
  141. Password:
  142.  
  143. and you must enter a password.  This is case sensitive (as is everything in
  144. UNIX) and not echoed as you type.  Assuming you get everything right, you
  145. should be rewarded with the login message; if you screw something up then
  146. you'll end up seeing the rather unpleasent
  147.  
  148. Login incorrect
  149.  
  150. login:
  151.  
  152. and you'll get to try again. Most systems get tired of you after four or five
  153. attempts and will drop the connection with a curt "too many attempts / bye".
  154.  
  155.  
  156. Once you've gotten past the login part, the UNIX system will automatically
  157. display any prominent bulletins from the administration (these are
  158. stored in the file /etc/motd if you ever need to see them again), and then
  159. proceeds to log you in according to the settings you have recorded in your
  160. .cshrc and .login scripts (these are usually preset for you, but you may want
  161. to play with them and customize things.  More on this later - see section 3.2).
  162. You may be asked to enter your terminal type (vt100 or vt220 are often the
  163. standards) while this process takes place, and you may be notified of any new
  164. news in the newsgroups you are subscribed to, along with any mail you have
  165. waiting.  If all goes well you will either end up in the shell - your command
  166. prompt.
  167.  
  168. UNIX comes with two default shells: the bourne shell (prompt is a dollar
  169. sign, '$') and the C Shell (prompt is a percent sign, '%').  On all the
  170. systems I've used, the C shell has been the default.  Often the prompt also
  171. includes the name of the machine (but not the current directory, like a $p$g
  172. in DOS).  Most systems also have the "tcsh" shell, which is an advanced
  173. version of the C-Shell with some nifty features.  More on using that
  174. later.
  175.  
  176. From here, you are free to explore with any of the topics mentioned
  177. elsewhere.  Keep in mind that when you want to quit, just type 'logout' to
  178. logoff the system.
  179.  
  180. To change your password at any time, simply enter the command, "passwd" at the
  181. prompt.  UNIX will ask you to type your old password, and if you get it right
  182. you will be able to enter a new one (you will also be asked to type it again
  183. for verification).
  184.  
  185. 2.2 Basic File Manipulation
  186. ---------------------------
  187.  
  188. Here I'll basically tell you the equivalents of your favourite DOS commands.
  189. To get full (but alas totally incomprehensible) help on ANY UNIX command, type
  190.  
  191. man [command]
  192.  
  193. man stands for the UNIX online manual.
  194.  
  195. *Command: ls..In DOS:.dir
  196. In UNIX, ls (a prophetic abbreviation for LiSt files) will list the files in
  197. the current directory.  Simply typing ls will give you a terse listing of
  198. filenames only (a lot like a dir /w).  By default, UNIX does not display any
  199. file beginning with a  period "." character (this is used so you don't have
  200. to see administrative files every time you do an ls command.)  Typing ls -a
  201. will show ALL files, including these hidden files.  Typing ls -l will display
  202. a listing in a long format, more similar to a normal DOS dir command.
  203. You can combine these options: ls -al will list all files, in long format.
  204. A useful additive is ls -F; this will mark all direcotires with a
  205. trailing slash (eg:  dirname/ ) in an ls listing.  this is a faster way
  206. of identifying directories than using ls -l.
  207.  
  208. *Command: pwd           In DOS: cd with no arguments
  209. pwd stands for "print working directory".  This is the best way to find out
  210. where in the hell you are.  It's quite easy to get lost on a mainframe system
  211. when changing directories raplidly; pwd will tell you what directory you are
  212. in by displaying the path from the root)
  213. You start in your Home Directory - this is your personal space to put Stuff.
  214. You can get info about your privelages by using the du and quota commands:
  215.  
  216. *Command: du..In DOS: No equivalent
  217. du will simply tell you how much disk space the files in the current directory
  218. are taking up.  It's handy to let you know where all your home directory space
  219. has gone.
  220.  
  221. *Command: quota..In DOS: No equivalent
  222. Use the command:
  223.  
  224. quota -v
  225.  
  226. to get information on your space restrictions.  you will usually be shown how
  227. much space you were given, and your maximum limit (usually you are allowed to
  228. go over by 100K or so, but you get nasty messages if you keep this much Stuff
  229. in your directory.  If you go over the limit, you will not be allowed to save
  230. any more Stuff.
  231.  
  232. *Command: cd..In DOS: cd / chdir
  233. cd is the basic method of changing directories.  Like in DOS, a single period
  234. '.' stands for the current directory (and can be used as a command argument)
  235. and a double period '..' stands for the parent directory (one level up).
  236. Unlike DOS, diretories in a path are seperated with FORWARD not backward
  237. slashes.  This will drive you absolutely nuts every time you shell to DOS
  238. from your communication program and try to change directories.  Furthermore,
  239. in UNIX, you have one extra symbol you can stick in a path.  The tilde
  240. character (~) stands for your home directory - this is very useful in a huge
  241. file structure such as you often find on mainframe systems.
  242. Examples:  cd ~/mystuff/textdir
  243. .   cd ../../incoming
  244.  
  245. *Command: cp..In DOS: copy
  246. cp is equivalent to the DOS copy command.  The only difference is that you
  247. MUST use two arguments: cp f1 f2  ; you cannot just leave off the second one
  248. and expect UNIX to default to the current directory.  (to achieve this you
  249. just use '.').  Thus, you cannot type 'cp News/rec.arts' and expect that
  250. file to pop into your current directory - you'd have to type one of the
  251. following:
  252. .cp News/rec.arts .
  253. .cp News/rec.arts rec.arts
  254. .cp News/rec.arts newname
  255. This command also brings us to the topic of the * wildcard character.  UNIX
  256. is quite a bit more versatile than DOS here - you can use a * parameter by
  257. itself to indicate you want all files, or even take a *.txt for example,
  258. which will even allow you to get files like this_has_a-longName.txt.
  259.  
  260. *Command: mv..In DOS: ren (well, sort of)
  261. The mv command moves the first file argument to the second file argument.
  262. You can use this to rename files, or to move them around.  Just like the
  263. cp command, you MUST use two arguments.
  264.  
  265. *Command: rm..In DOS: del or erase
  266. The rm command will ReMove a file.  There is no warning before it does it and
  267. it's pretty much irreversable (Central Point Undelete can't help you now that
  268. you've left Kansas). Even more annoying, you can type rm * and kill EVERYTHING
  269. very quickly without an 'Are you sure' prompt.  It is sometimes a good idea
  270. to call rm with the -i switch so that it confirms each deletion seperately.
  271. It is actually an even better idea to alias it to always use the -i switch -
  272. see section 3.1.  You can remove a DIRECTORY and all its contents (no
  273. verification) by using rm -r [dirname].
  274.  
  275. *Command: mkdir.In DOS: md or mkdir
  276. mkdir functions the same as in DOS - it creates a subdirectory in the current
  277. directory.
  278.  
  279. *Command: rmdir..In DOS: rd or rmdir
  280. rmdir will remove an EMPTY directory, the same as the equivalent DOS
  281. command.  Similarly, if there are still files in the directory rmdir will
  282. display an error message.  Use rm with the -r switch to remove a directory
  283. and contents.
  284.  
  285. *Command: cat..In DOS: type
  286. the cat command will display the contents of a file to the screen with no
  287. formatting and no pauses - it functions exactly the same as the DOS type
  288. command.  Similarly in DOS and UNIX, if you try to display the contents of a
  289. binary file you may get unpredicatble results and you probably won't get to
  290. see the whole file contents.  Cat is often used in conjunction with the UNIX
  291. pipe and redirection commnands.  These commands exist in DOS where they are
  292. seldom used; in UNIX they're extremely useful and you will want to use them a
  293. lot.
  294.  
  295. *Command: >, <, |  In DOS: <,>,| - file redirection and pipes
  296. You can send the output of a command to a file by using the redirect output
  297. (greater-than sign, '>') command.  For example, you can crudely copy a file
  298. by using this command:
  299.  
  300. cat [file1] > [file2].
  301.  
  302. (This is useful when you have read permissions to a file but not exec
  303. permissions and you can't copy it  with the cp command but can display it
  304. with cat).  Similarly, you can redirect the input to make it a file rather
  305. than the  'standard input'.  This is done with the input redirection (less
  306. than sign,'<') command.  For example, you could issue the command:
  307.  
  308. ed /etc/passwd <rootscript >newpsswd
  309.  
  310. Which would run ed on the /etc/passwd file, issuing the commands as you have
  311. typed them into the file rootscript, and then output any messages to newpsswd.
  312.  
  313. Using the symbol '>>' will append to the destination file rather than
  314. overwriting it as you would with '>'.  So you can:
  315.  
  316. crack <passwd >>valids
  317.  
  318. You get the idea...
  319.  
  320. The pipe command "|" allows you connect the output from one program to the
  321. input of another.  For example:
  322.  
  323. ls -al | stripblanks >>outfile
  324.  
  325. would run the executable 'stripblanks' with its input as the output of the
  326. 'ls -al' command, and the output from stripblanks is appended to the file
  327. 'outfile'.
  328.  
  329. *Command: grep..In DOS: No equivalent
  330. grep is a useful command that lets you pick needles out of haystacks.  The
  331. syntax is:
  332.  
  333. grep [<">pattern<">] [filename]
  334.  
  335. You type a pattern to search for (use quotation marks around it if it
  336. contains any spaces) and a filename and grep will dispaly all the LINES in
  337. filename that contain the pattern.  For example,
  338.  
  339. grep root /etc/utmp
  340.  
  341. Will find and display all lines with the pattern "root" in the file /etc/utmp.
  342. Using grep on a binary file can have unpredictable results.  grep is
  343. especially useful for files where one record takes up one line - it allows
  344. you to quickly get the information you need.
  345.  
  346. *Command: history.In DOS: No equivalent
  347. History allows you to see what the past 10 commands (10 by default) that you
  348. typed are.  Each command is numbered although the system usually saves only
  349. the last 10.  You can turn off this saving of commands by using set history=0
  350. (this is not available on BSD UNIX, but you can delete any incriminating
  351. history files by deleting the .history file in your home directory).  You can
  352. also opt to keep more or less than 10 commands using the set history= command.
  353.  
  354. *Command: !..In DOS: F3 and F1 do a little of this
  355. Typing !! will repeat the last command verbatim, like using F3 in DOS.  You
  356. can also type !23 and get command 23 (as it is shown in history) repeated.
  357. Or you can even type !gre and the last command with the pattern 'gre' in it
  358. (most likely a grep command) will be repeated.
  359.  
  360. With just those simple commands, you are able to perform most of the file
  361. manipulation you will need.
  362.  
  363. 2.3 The manic man command
  364. -------------------------
  365.  
  366. Invaraibly, you will reach the point where you will want to know more 
  367. than is found in this file.  Or, you will ask someone for help on 
  368. something, and they will say something to the order of:
  369.  
  370.    Just see vi(5) and blah blah blah blah.
  371.  
  372. In UNIX, the entire manual is online for you to use.  It's so absolutely 
  373. huge that you would never want the whole thing (indeed, when you see 
  374. printed copies they usually take up more kitchen counter space than June 
  375. Cleaver had in her house).  When people refer to programs as progname(#) 
  376. they are actually dropping you an estoeric UNIX hint about getting more 
  377. information.  The number in brackets is the section of the UNIX manual 
  378. (there are less than ten of these volumous beasts, I believe) which has 
  379. the information they are referring to.  To get that information you can 
  380. usually just type
  381.  
  382. man progname
  383.  
  384. In some cases, you will want to search in another section than what
  385. pops up - in this case just add the section number:
  386.  
  387. man vi 5
  388.  
  389. or something to that effect.  When you are reading the man pages, you 
  390. will probably be in either the "more" or "less" viewer programs.  You 
  391. can move around in these with the following keys:
  392.  
  393. Key:     Action:
  394. ----     -------
  395. (space)  Next page
  396. (enter)  Next line
  397. g        Beginning of file
  398. G        End of file
  399. n        Next Page
  400. b        Previous Page
  401. /sometxt Search for the next occurrence of "sometxt" (hit Enter to start 
  402.          the search).
  403.  
  404. With a little luck and some intuition, you can wade through the man 
  405. pages and find what you are after.  Keep in mind that they are complete 
  406. technical specifications for the commands, and are not necessarily 
  407. written to be easily understood.  Rather, they just list all the options 
  408. and blurb about the item in question in as much technical jargon as 
  409. possible.  Should you really need to pore over it, you might want to 
  410. pipe the manual into a file:
  411.  
  412. man more > more.man
  413.  
  414. This will create a file called "more.man" in the current directory, 
  415. which contains the manual pages for the command more(1).
  416.  
  417. 2.3 Reaching Nirvanna through ed(1) - Text Manipulation
  418. -----------------------------------
  419.  
  420. One of the chief commoddities that you'll be getting your grubbly little
  421. hands on using UNIX is information.  You need a method to keep all this
  422. Stuff, hence text manipulation.  I'll go over creating a file first, so you
  423. can have your very own to look at.  The easiest way to create a text file is
  424. through ed(1).  If you liked EDLIN, you'll love ed at your prompt, type:
  425.  
  426. ed [filename]
  427.  
  428. If [filename] is a new file you'll be told so, and then be left waiting.
  429. typing 'a' allows you to start adding to the file (though no indication is
  430. given that you have done so.)  Type away and then when you're finished
  431. enter a single period on a line by itself to end the input.  Now you can type
  432. one of the following commands:
  433. w - write to disk
  434. q - exit - if you haven't saved a ? is printed and you are given salvation
  435. p - list current line
  436. 1,$p - list first to last line ($ = the last line)
  437.  
  438. More archaic commands are available; see man ed for more help.
  439.  
  440. If this form of torture isn't entirely your scene then there is a much
  441. friendlier text editor available named vi (for Visual Editor), which you will
  442. immediately hate.  But given time you will really get to like it.  Call vi by
  443. typing vi [filename] and a nice screen will pop up with tilde marks down the
  444. left side and 'filename [New File] mm/dd/yy' at the top.  Now, I realise
  445. that there must be SOME vi help SOMEWHERE, but I can't find it.  So
  446. here's a rough guideline to using it.
  447.  
  448. vi has three modes that you might be in.  For lack of some wierd-ass
  449. UNIX abbreviations for them, I've made my own names for them.  You start
  450. out in VISUAL editor mode, and can go to INSERT mode or COMMAND mode.
  451.  
  452. If you "vi newfile" or some unexisting file, you will see a bunch of
  453. tildes down the left hand side of the screen and that is it.  to
  454. actually start typing (ie to move from VISUAL mode to INSERT mode), you
  455. must choose the insert command, or "i".  You can also choose "a" which
  456. does the same thing, but moves you ONE CHARACTER right before adding
  457. text.  You can't move further left than where you started either (to,
  458. for example, correct a mistake you just noticed earlier in the line).
  459.  
  460. However, once in INSERT mode you can just type normally.  When you want
  461. to move around, or do some editing, or something, you'll want to move
  462. back to VISUAL mode.  Do this by hitting [ESC].  Now, you can move
  463. around with the movement keys:
  464. j = one char left, k = one char right, k = one char up, l = one char down.
  465.  
  466. Or, you can delete a character in front of the current cursor position:
  467. x = delete one character
  468. dd = delete entire line (analagous to Ctrl-Y in wordstar)
  469.  
  470. You can also move up a page:
  471. b = go back one page
  472. n = go to next page
  473. g = go to start of docuemnt
  474. G = go to end of document
  475.  
  476. You can also repeat commands by typing a number first.  So for example,
  477. typing 10dd will delete the next 10 lines.  typing 50j will move left
  478. fifty characters.
  479.  
  480. Once you have everything edited and looking good, you'll want to save.
  481. Go to COMMAND mode by hitting Q (must be upper case) from VISUAL mode
  482. (and you will have to do [ESC]Q from INSERT mode).
  483.  
  484. You will see a prompt (a colon) pop up at the bottom of the screen and
  485. the cursor will go there. At this point you are basically in ed(1)
  486. again.  You can use the "w" command to write the file, then the "q" to
  487. quit... or you can quit without changing by doing a "quit!" (it forces
  488. you to do this if you haven't saved).  If you messed up and want to go
  489. back to VISUAL mode from command mode, just enter the command "vi".
  490. Many other commands are available but those are enough to get you by
  491. on a day to day basis.  With vi, practice definitely makes perfect.
  492.  
  493. There is also a quicker way to get to command mode, but it returns you 
  494. right back into visual mode when you have entered each command.  From 
  495. visual mode, just type a colon ":" and the colon will appear, then type 
  496. the command and ENTER.  Once it has executed you are back in visual 
  497. mode.  This is faster in a lot of cases.
  498.  
  499. There is one more ESSENTIAL command for happy vi'ing.  It's the undo
  500. command, "u".  You can use the "u" command from VISUAL mode any time
  501. you like to undo the last editing action.  Using it a second time will
  502. re-do the last edit action.
  503.  
  504. 2.4.Intra-system communication
  505. ----------------------------------
  506.  
  507. UNIX is designed as a multi-user operating system.  Thus the chances of only
  508. one person being logged on the system at the same time are quite slim; in
  509. large mainframes there are often well over 20 people logged in at once, even
  510. during off hours.   UNIX allows you, using a number of built-in functions, to
  511. communicate with and annoy these people freely.  This is extremely useful for
  512. getting information in a hurry.  Coffee Talk thrives under UNIX.
  513.  
  514. *Command: who
  515. The who command will tell you who is logged into the system.  You are given
  516. two fields of information about each user.  Their login id is shown, and the
  517. port that they are logged in from (called a tty - usually of the form ttyxx
  518. where xx can be any combination of letters and numbers).  Try this command
  519. now.  Usually there will be an operator logged in always, regardless of who
  520. is on the system - this is just an account that stays open all the time and
  521. should cause you no sudden paranoia.
  522.  
  523. The next thing we will want to do is commuinicate with these people.  If
  524. there's someone you know (or you can even do this to yourself, it will work
  525. fine) then write them a note:
  526.  
  527. *Command: write
  528. At your shell prompt, use 'write [userid]' to write another user.  They will
  529. hear a beep, and on their screen they will see:
  530.  
  531. MESSAGE FROM yourid ON TTYxx
  532.  
  533. Followed by each line of text you type, as soon as you finish typing it.
  534. When you've finished your message, you can hit CTRL-D to finish - the person
  535. you were writing to will see 'EOF' on their screen.
  536.  
  537. You can also pipe and redirect things into the input of a write function -
  538. thus you can type a notice and:
  539.  
  540. write auser <notice.txt
  541.  
  542. I have a program called banner which just makes a large banner of the argument
  543. (in big friendly letters).  I often greet people with this command:
  544.  
  545. banner Good Morning! | write auser
  546.  
  547. If a user is logged on more than once, you will see a message:
  548.  
  549. User auser logged on more than once - writing to ttyxx
  550.  
  551. If for some reason they aren't responding you can try another tty - simply
  552. add which tty you want to write to after the command (don't include the
  553. 'tty').  For example, to write to user jblow on ttyie:
  554.  
  555. write jblow ttyie
  556.  
  557. Sometimes write will tell you:
  558.  
  559. Cannot write to ttyxx - Permission denied.
  560.  
  561. This means that the person has turned off their messages and obviously
  562. doesn't want to be disturbed by people writing them.
  563.  
  564. *Commmand: mesg
  565. mesg controls whether your messages are on or off.  The default is to have
  566. them on so that people can write you; you can turn them off however by
  567. issuing the command:
  568.  
  569. mesg n
  570.  
  571. Or turn them on using
  572.  
  573. mesg y
  574.  
  575. Typing 'mesg' with no aruments will tell you what the current setting is.
  576.  
  577. You can find out whether a person's messages are on or off, and a lot more
  578. useful information by using the finger command.
  579.  
  580. *Command: finger
  581. finger is one of the most useful UNIX commands you will encounter.  Sometimes
  582. versions of finger vary depending on your system; but on most new System V
  583. and BSD UNIX systems the format is exactly the same.  Finger is like an
  584. extended who, which also allows you to get specific information on a user.
  585.  
  586. for example, you could type
  587.  
  588. finger jblow
  589.  
  590. and get the following:
  591. [blah blah blah]
  592.  
  593. You are given the user's login id, message status (if messages are off you
  594. are told so), time of login, idle time (time since user last entered a
  595. command), when the mail was last read, the contents of the user's ~/.plan
  596. and ~/.project files, and the user's full name.
  597.  
  598. The .project and .plan information is specified by creating files in your
  599. home directory named .project and .plan respectively.  Note that only the
  600. first line of the .project file is shown.  Some serious anal-retentive people
  601. use this for its intended purpose, but most people put a friendly or silly
  602. greeting in there (really dumb people provide you with their home address
  603. and telephone number... heh heh heh).
  604.  
  605. Whoever set up your account most likely entered your full name in the "In
  606. real life:" field - you can in fact change this to whatever you like using
  607. chfn.
  608.  
  609. *Command: chfn
  610. chfn (for CHange Full Name), allows you to change the contents of the "In real
  611. life" field when someone fingers you.  Just enter 'chfn' at the prompt and
  612. you will be asked for a new full name - as your last name is given by your
  613. id in most cases, lots of people stick their first name in here (It's not
  614. kosher to call yourself Adolf Hitler on UNIX systems, by the way).
  615.  
  616. *Command: talk
  617. When you tire of the akwardness of the write command, you might want to try
  618. the talk command.  This bascially allows you to chat to another user in a
  619. nice split-screen chat mode; your typing goes on one half of the screen and
  620. the person's that you're talking to goes on the other.  Talk is much more
  621. sophisticated too in that it gently pages the user without just barging in on
  622. their screen.  Attempt to talk to someone else by typing:
  623.  
  624. talk userid
  625.  
  626. And they will hear a beep and see this message:
  627.  
  628. You are being paged by jblow@machine.address.address
  629. To respond type talk jblow@machine.address.address
  630.  
  631. Don't worry about the @ sign or the address information for now - I'll
  632. explain that in the next section.  You can actually reply to someone on your
  633. own system just by typing the userid - (you don't need the @ sign or the
  634. address).
  635.  
  636. While this is going on, the person who initiated the page is waiting in a
  637. blank talk screen and getting a status report on how the paging is going.
  638. When the person finally responds the top status line will say
  639.  
  640. [Connection Established]
  641.  
  642. and you can begin typing.  To stop talking use Ctrl-C to exit.
  643.  
  644. If you are talking to someone on your machine and they are logged in
  645. more than once you can pick the tty to talk to (just like with write).
  646. but this time, you use just the two letters at the end:
  647.  
  648. talk jblow i5
  649.  
  650. will talk to jblow on ttyi5.
  651.  
  652. *Command: mail
  653. Using the mail command, you can send electronic mail to any user of the
  654. system, and you can read any mail that you have waiting in your own mailbox.
  655. Most sytems will notify you if you have mail when you log in.  To check your
  656. mail box type:
  657.  
  658. mail
  659.  
  660. If there is no mail for you you will be told so, otherwise the list of
  661. subject lines, or headers, will appear on the screen.  Each message header
  662. has a number and tells you who it's from, as well as the subject.  You can
  663. then hit <enter> to start reading at the first message.
  664. Like ed, mail has the concept of a current message - you can use any of the
  665. mail editing commands and they will effect the current message, or you can
  666. specify which message you want them to work on.  The commands are:
  667.  
  668. h ..- Redisplay the list of headers
  669. d<#> ..- Delete message
  670. r<#> ..- reply to message
  671. s<#> <filename> - save message (it will save it to a file called mbox unless
  672. you type a
  673.                   filename using 's filename')
  674. q ..- quit and append all undeleted messages to the ~/mbox file
  675. x ..- exit, leaving the messages pending in your incoming mailbox.
  676.  
  677. the mbox file is a file in your home directory where any mail that you don't
  678. delete is kept.  You can go through and edit or delete this as you please;
  679. it's a convenient place for storing mailings you want to keep for a while.
  680.  
  681. To mail another user, type:
  682.  
  683. mail userid
  684.  
  685. You will be prompted for a subject (which the other user will see in their
  686. headers when they type mail).  Then you are free to type whatever you want in
  687. the mailing and end it with a CTRL-D character.
  688.  
  689. If you mess up their userid the mail will eventually get returned to you and
  690. you can save it in mbox or somewhere else, edit it and then try again.  In
  691. chapter 4, I'll explain how to mail someone anywhere in the world, assuming
  692. you know their address.
  693.  
  694. If you are lucky, there is a program called "elm" on your system.  elm
  695. is a much more advanced mailing system then the default mail(1), and
  696. allows you to quote in your replies and use vi to write them etc.  Find
  697. out by just typing "elm" (it will be in the path if it's there) or if
  698. you suspect it's around but not in the path then talk to the
  699. administration on your system and bug them about it.
  700.  
  701.  
  702. 2.5 Multitasking without L.S.D.
  703. -------------------------------
  704.  
  705. Multitasking on UNIX is extremely useful and very easy to do.  Each 'thing'
  706. you have running on the system is called a process or job.  The shell which
  707. you use to enter commands is a job which is always running; when it ends
  708. you are logged out of the system.
  709.  
  710. *Command: jobs
  711. To find out what jobs you have running, type the command:
  712.  
  713. jobs
  714.  
  715. from the shell.  A list of all jobs currently running (each one with its own
  716. number) is shown.  Initially all you will see is your shell.
  717.  
  718. You get out of a job and back to the shell (where you can start new jobs) by
  719. using the CTRL-Z hotkey.  When you CTRL-Z a process its exectution is
  720. suspended, and UNIX issues the message
  721.  
  722. Stopped
  723. %
  724.  
  725. and you are returned to the command prompt.  Try this - look up something in
  726. the manual by typing:
  727.  
  728. man talk
  729.  
  730. and wait until the screen appears, then hit CTRL-Z.  You will be returned to
  731. the shell. Typing 'jobs' shows you that, sure enough, process number two is
  732. man talk, and that the job is currently stopped.  There will also be a '+'
  733. symbox next to it, meaning simply that this is the CURRENT job.  The csh job
  734. will most likely have a '-' symbol next to it, indicating that it is the
  735. PREVIOUS job.
  736.  
  737. You control which job you're seeing on the screen using the fg command.
  738.  
  739. *Command: fg
  740. fg will put a specified job in the foreground.  To put the job listed as
  741. CURRENT (+) in jobs into the foreground, type fg %.  The job resumes
  742. execution from where you stopped it.  To put a specific job in the foreground
  743. by number, use fg %n where n is the number of the job.
  744.  
  745. You can also keep processes running in the background while you do ohter
  746. things - this is achieved using the bg command.
  747.  
  748. *Command: bg
  749. bg will place a specified job (use %n or %) into the background and continue
  750. its execution.  Note that if this job decides it's going to output to the
  751. screen it will display right over whatever you are doing in the foreground.
  752. You can avoid this by redirecting the output using > when you start the
  753. process. This can be very chicken-and-egg if you don't know that you're going
  754. to stick it in the background when you start though; most times it's not
  755. really worth the hassle.
  756.  
  757. When a process finishes execution and exits while still in the background you
  758. will be notified by UNIX that it has finished.
  759.  
  760. *Command: &
  761. Using an ampersand '&' after a command line will automatically put that job
  762. in the background.  So, for example, you could type:
  763.  
  764. crack /etc/passwd >validfile &
  765.  
  766. and that process would begin running in the background, piping its output to
  767. validfile and allowing you to go on and play with other things.
  768.  
  769. *Command: ps
  770. ps, another wizard abbreviation for ProceS
  771.  
  772.